﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DTO;
namespace DAO
{
    public class DangKyPhimDAO
    {
        //load ds phim theo rạp
        public static DataTable LOAD_DSPHIM_THEO_RAP(string MaRap)
        {
            DataTable dsPhimTheoRap = new DataTable();
            SqlConnection cn;
            cn = DataProvider.ConnectionData();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "SP_LOAD_DSPHIM_THEO_RAP";
            cmd.Connection = cn;

            SqlParameter para;
            para = new SqlParameter("MARAP", SqlDbType.NVarChar, 20);
            para.Direction = ParameterDirection.Input;
            para.Value = MaRap;
            cmd.Parameters.Add(para);

            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet a = new DataSet();
            da.Fill(a);
            dsPhimTheoRap = a.Tables[0];
            cn.Close();
            return dsPhimTheoRap;
        }
        //load ds phim theo mã định dạng
        public static DataTable LOAD_DSPHIM_THEO_MADINHDANG(int MDD)
        {
            DataTable dsPhimTheoMDD = new DataTable();
            SqlConnection cn;
            cn = DataProvider.ConnectionData();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "SP_LOAD_DSPHIM_THEO_MADINHDANG";
            cmd.Connection = cn;

            SqlParameter para;
            para = new SqlParameter("MDD", SqlDbType.NVarChar, 20);
            para.Direction = ParameterDirection.Input;
            para.Value = MDD;
            cmd.Parameters.Add(para);

            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet a = new DataSet();
            da.Fill(a);
            dsPhimTheoMDD = a.Tables[0];
            cn.Close();
            return dsPhimTheoMDD;
        }
    }
}
